#ifndef _STYLE_H_
#define _STYLE_H_
#include "main.h"

def s_moveto(x, y):
    return ("\033[" + str(y) + ";" + str(x) + "H")

def s_clean():
    print(s_clear)
    return s_clear

def s_left(s, w):
    chineselen = len(s.encode('cp936'))-len(s)
    return '{0:{width}}'.format(s,width=w-chineselen)


def s_show():
    print(s_visible)
    return s_visible

def s_hide():
    print(s_invisible)
    return s_invisible
# 清除效果
s_reset = "\033[0m"
# 背景: 深色
s_bgblack  = "\033[40m"
s_bgred    = "\033[41m"
s_bggreen  = "\033[42m"
s_bgyellow = "\033[43m"
s_bgblue   = "\033[44m"
s_bgpurple = "\033[45m"
s_bggrass  = "\033[46m"
s_bgwhite  = "\033[47m"

# 背景: 深色
s_lbgblack  = "\033[100m"
s_lbgred    = "\033[101m"
s_lbggreen  = "\033[102m"
s_lbgyellow = "\033[103m"
s_lbgblue   = "\033[104m"
s_lbgpurple = "\033[105m"
s_lbggrass  = "\033[106m"
s_lbgwhite  = "\033[107m"

# 文字: 深色
s_black    = "\033[30m"
s_red      = "\033[31m"
s_green    = "\033[32m"
s_yellow   = "\033[33m"
s_blue     = "\033[34m"
s_purple   = "\033[35m"
s_grass    = "\033[36m"
s_white    = "\033[37m"
# 文字: 亮色
s_lblack   = "\033[90m"
s_lred     = "\033[91m"
s_lgreen   = "\033[92m"
s_lyellow  = "\033[93m"
s_lblue    = "\033[94m"
s_lpurple  = "\033[95m"
s_lgrass   = "\033[96m"
s_lwhite   = "\033[97m"

# 特效
s_under    = "\033[4m"   # 下划线
# s_blink    = "\033[5m"   # 闪烁 
# s_op       = "\033[7m"   # 反显 
# "\033[8m"   消隐 

# 控制
s_clear = "\033[2J"    # 清屏
s_visible  = "\033[?25h"   # 显示光标
s_invisible  = "\033[?25l"   # 隐藏光标
s_save  = "\033[s"      # 保存光标位置
s_resume= "\033[u"      # 恢复光标位置


#endif
#==========  颜色  ==========
# 颜色两位 背景+文字
# 0 = 黑色 8 = 灰色
# 1 = 蓝色 9 = 淡蓝色
# 2 = 绿色 A = 淡绿色
# 3 = 湖蓝色 B = 淡浅绿色
# 4 = 红色 C = 淡红色
# 5 = 紫色 D = 淡紫色
# 6 = 黄色 E = 淡黄色
# 7 = 白色 F = 亮白色

# 字颜色:30-----------37
# 30:黑 
# 31:红 
# 32:绿 
# 33:黄 
# 34:蓝色 
# 35:紫色 
# 36:深绿 
# 37:白色 

# 字背景颜色范围:40----47
# 40:黑 
# 41:深红 
# 42:绿 
# 43:黄色 
# 44:蓝色 
# 45:紫色 
# 46:深绿 
# 47:白色

# 字体加亮颜色:90------------97
# 90:黑 
# 91:红 
# 92:绿 
# 93:黄 
# 94:蓝色 
# 95:紫色 
# 96:深绿 
# 97:白色

# 背景加亮颜色范围:100--------------------107
# 100:黑 
# 101:深红 
# 102:绿 
# 103:黄色 
# 104:蓝色 
# 105:紫色 
# 106:深绿 
# 107:白色


# ===========特效===========
 
# \033[0m  关闭所有属性 
# \033[1m   设置高亮度 
# \03[4m   下划线 
# \033[5m   闪烁 
# \033[7m   反显 
# \033[8m   消隐 
# \033[30m   --   \033[37m   设置前景色 
# \033[40m   --   \033[47m   设置背景色


#==========光标控制==========
# \033[nA 光标上移n行 
# \033[nB 光标下移n行 
# \033[nC 光标右移n行 
# \033[nD 光标左移n行 
# \033[yxH设置光标位置 
# \033[K 清除从光标到行尾的内容 
# \033[s 保存光标位置 
# \033[u 恢复光标位置 
# \033[?25l 隐藏光标 
# \033[?25h 显示光标

# \033[2J 清屏 


# 实心方块 \u2590 上半块
# 实心方块 \u2581 -- \u2587 下八分之一 --> 下八分之七
# 实心方块 \u2588 全块
# 实心方块 \u2589 -- \u258f 左八分之七 --> 左八分之一
# 实心方块 \u2590 右半块
